﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true"
    CodeBehind="Boleto.aspx.cs" Inherits="RzCorportativo.Views.Financeiro.Boleto" %>

<%@ Register Assembly="Boleto.Net" Namespace="BoletoNet" TagPrefix="bn" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="LeftContent" runat="server">
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="MainContent" runat="server">
<script src="<%=this.ResolveUrl("~/Recursos/j/eComplete.js")%>" type="text/javascript"></script>
    <asp:HiddenField runat="server" ID="PacienteId" />
    <div class="controls controls-row">
        <asp:TextBox runat="server" ID="DataVencimento" date="true" mask="calendar" placeholder="Data de Vencimento da 1ª parcela" />
    </div>
    <div class="controls controls-row">
        <asp:TextBox runat="server" ID="Valor" placeholder="Valor total do boleto" mask="money" />
    </div>
    <div class="controls controls-row">
        <asp:TextBox runat="server" ID="Parcelas" placeholder="Número de parcelas" mask="number" range="10"/>
    </div>
    <div class="controls controls-row">
        <asp:TextBox runat="server" ID="Cpf" placeholder="CPF" data-toggle="tooltip" mask="cpf"
            title="CPF do paciente" data-placement="left" name="complete" value="" auto-complete="true"
            eid="cpf" requesttype="post" contenttype="application/json; charset=utf-8" isasync="true"
            length="1" datatype="json" templeted="true" onrender="getItemPaciente" onerror="getErrorPaciente"
            onselected="selectedItemPaciente" />
        <asp:TextBox runat="server" ID="Sacado" placeholder="Sacado" /></div>
    <div class="controls controls-row">
        <asp:TextBox runat="server" ID="Endereco" placeholder="Endereço" /></div>
    <div class="controls controls-row">
        <asp:TextBox runat="server" ID="Bairro" placeholder="Bairro" /></div>
    <div class="controls controls-row">
        <asp:TextBox runat="server" ID="Cidade" placeholder="Cidade" /></div>
    <div class="controls controls-row">
        <asp:TextBox runat="server" ID="Cep" placeholder="CEP" /></div>
    <div class="controls controls-row">
        <asp:TextBox runat="server" ID="UF" placeholder="UF" /></div>
    <asp:Button Text="gerar boleto" runat="server" OnClick="btn_Click" ID="btn" />
    <asp:Panel runat="server" ID="pnlControl">
    </asp:Panel>
    <script type="text/javascript">
        function Back() {
            window.location.href = '<%=this.ResolveUrl("~/Views/Farmacia/Atendimento.aspx")%>';
            return false;
        }
        /************************************************ PACIENTE **************************************************************/
        function getItemPaciente(ul, item) {

            var inner_html = '<a><div class="list_item_container"><div class=""><strong>Nome:</strong> ' +
                            item.Nome + '</div><div class="description"><strong>CPF: </strong>' +
                            item.Cpf + '</div></div></a>';
            return $("<li style='width:350px'></li>")
            .data("item.autocomplete", item)
            .append(inner_html)
            .appendTo(ul);
        }
        function getErrorPaciente(e) {
            var _alert = new Alert();
            _alert.Name = "erroGeral";
            _alert.Type = AlertType.Error;
            _alert.AddMessage(e.d ? e.d : e.responseText);
            _alert.Show();
        }
        function selectedItemPaciente(event, ui, context) {
            var item = ui.item && ui.item.value ? ui.item : context;
            if (item.PacienteId) {
                $("input[id$='PacienteId']").val(item.PacienteId.toString(10))
            }
        }

    </script>
</asp:Content>
